function RegionInfo(context_path,page_province_id,page_db_province_id,page_city_id,page_db_city_id,page_district_id,page_db_district_id,suffix){
	this.province_id = page_province_id;
	this.db_province_id = page_db_province_id;
	this.city_id = page_city_id;
	this.db_city_id =page_db_city_id;
	this.district_id = page_district_id;
	this.db_district_id = page_db_district_id;
	this.context_path = context_path;
	$.ajax({cache:false, url:this.context_path+"/ajax/ajaxGetAllProvince.do", type:"post", dataType:"json", success:function(json){eval(suffix).updateProvince(json,suffix);}});
}
RegionInfo.prototype.getAllCity=function(suffix){
	var pid = $("#"+this.province_id).val();
	var obj = document.getElementById(this.district_id);
	this.initOption(obj);
	if(pid==null||pid=="") {
		obj = document.getElementById(this.city_id);
		this.initOption(obj);
		return;
	}
	$.ajax({cache:false, url:this.context_path+"/ajax/ajaxGetAllCity.do", type:"post", dataType:"json", data:{pid:pid}, success:function(json){eval(suffix).updateCity(json,suffix);}});
};
RegionInfo.prototype.getAllDistrict=function(suffix) {
	var cid = $("#"+this.city_id).val();
	if(cid!=null&&cid!="")
		$.ajax({cache:false, url:this.context_path+"/ajax/ajaxGetAllCity.do", type:"post", dataType:"json", data:{pid:cid}, success:function(json){eval(suffix).updateDistrict(json,suffix);}});
	else {
		var obj = document.getElementById(this.district_id);
		this.initOption(obj);
	}
};
RegionInfo.prototype.updateProvince=function(json,suffix) {
	var s_root = document.getElementById(eval(suffix).province_id);
	var obj_db_province_id = document.getElementById(eval(suffix).db_province_id);
	eval(suffix).writeSelectOption(s_root,obj_db_province_id,json);
	if(obj_db_province_id!=null){
		eval(suffix).getAllCity(suffix);
	}
};
RegionInfo.prototype.updateCity=function(json,suffix) {
	var s_root = document.getElementById(eval(suffix).city_id);
	var obj_db_city_id = document.getElementById(eval(suffix).db_city_id);
	eval(suffix).writeSelectOption(s_root,obj_db_city_id,json);
	if(obj_db_city_id!=null){
		eval(suffix).getAllDistrict(suffix);
	}
};
RegionInfo.prototype.updateDistrict=function(json,suffix) {
	var s_root = document.getElementById(eval(suffix).district_id);
	var obj_db_district_id = document.getElementById(eval(suffix).db_district_id);
	eval(suffix).writeSelectOption(s_root,obj_db_district_id,json);
};
RegionInfo.prototype.writeSelectOption=function(obj,db_obj,list) {
	this.initOption(obj);
	for (var i in list) {
		var option = document.createElement("option");
		var value = list[i].regionId;
		var text = list[i].region;
		if(db_obj!=null&&db_obj.value==value){
			option.selected=true;
		}
		option.text = text;
		option.value = value;
		obj.options[obj.options.length] = option;
	}
};
RegionInfo.prototype.initOption=function(obj){
	if(obj != null){
		obj.options.length = 0;
		var firstOption = document.createElement("option");
		firstOption.text="请选择";
		firstOption.value="";
		obj.options[obj.options.length] = firstOption;
	}
};
function getAllCity(suffix){
	eval(suffix).getAllCity(suffix);
}
function getAllDistrict(suffix){
	eval(suffix).getAllDistrict(suffix);
}